FROM node:18-alpine3.14

WORKDIR /app

COPY package.json .
COPY *.lock .
COPY --chown=node:node . .

RUN apk add netcat-openbsd

RUN npm set registry https://registry.npmmirror.com  && npm install pm2 -g && npm install -g dotenv-cli

RUN  npm install

RUN npm run build dicom-server \
    && npm run build gateway \
    && npm run build peer-server \
    && npm run build system-server \
      # todo breath 目前还不能通过docker打包
    #&& npm run "build:breath in docker"


RUN chmod +x /app/start.sh

RUN sed -i 's/\r$//' /app/start.sh

EXPOSE ${GATEWAY_HTTP_PORT} ${GATEWAY_SOCKET_IO_PORT} ${RC_SERVER_HTTP_PORT}

CMD ["/app/start.sh"]
